package cn.wen.yinxiu.product.service;

import cn.wen.yinxiu.common.to.product.SkuLockTO;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.wen.yinxiu.common.toolkit.PageUtils;
import cn.wen.yinxiu.product.entity.StockSkuEntity;

import java.util.Map;

/**
 *
 * @ClassName: StockSkuService
 * @Author 小飞
 * @Email coderwen22@163.com
 * @Date 2023-05-22 09:55:17
 * @Description: 商品库存的Service类
 */
public interface StockSkuService extends IService<StockSkuEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 判断当前是否存在库存
     *
     * @param skuId
     * @return
     */
    boolean getSkuHasStock(Long skuId);

    /**
     * 锁库存
     *
     * @param lockTO
     * @return
     */
    boolean orderLockStock(SkuLockTO lockTO);

    /**
     * 解锁库存
     * @param skuId
     * @param num
     */
    void unLockStock(Long skuId, Integer num);
}

